package com.codingInn.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class MyDataContextListener implements ServletContextListener {
	private ServletContext context = null;

	public MyDataContextListener() {
		System.out.println("MyDataContextListener.....");
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		this.context = sce.getServletContext();
		this.context.setAttribute("myData","this is mydata");
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		this.context = null;
	}
}
